<extend name="./Application/Admin/View/Layouts/application.html"/>

<block name="content">
    <div class="admin-content">
        <div class="admin-content-body">
            <div class="am-cf am-padding am-padding-bottom-0">
                <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">用户组列表</strong> /
                    <small>Group List</small>
                </div>
            </div>

            <hr>

            <div class="am-g">
                <div class="am-u-sm-12 am-u-md-6">
                    <div class="am-btn-toolbar">
                        <div class="am-btn-group am-btn-group-xs">
                            <a href="{{:U('AuthSet/add_group')}}" class="am-btn am-btn-default"><span
                                    class="am-icon-plus"></span> 新增
                            </a>
                        </div>
                    </div>
                </div>

                <div class="am-u-sm-12 am-u-md-3">
                    <div class="am-input-group am-input-group-sm">
                        <input type="text" name="name" class="am-form-field">
                        <span class="am-input-group-btn">
                                <button class="am-btn am-btn-default" type="submit">搜索</button>
                            </span>
                    </div>
                </div>

            </div>

            <div class="am-g">
                <div class="am-u-sm-12">
                    <form class="am-form">
                        <table class="am-table am-table-striped am-table-hover table-main">
                            <thead>
                            <tr>
                                <th>
                                    <input type="checkbox" class="check_all"/>
                                </th>
                                <th>编号</th>
                                <th>用户组名</th>
                                <th>创建时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>

                            <volist name="auth_groups" id="auth_group">
                                <tr data-id="{{$auth_group.id}}">
                                    <td>
                                        <input type="checkbox" name="ids[]" value=""
                                               class="checked_id"/>
                                    </td>
                                    <td>{{$auth_group.id}}</td>
                                    <td>{{$auth_group.title}}</td>
                                    <td>{{$auth_group.created_at|date='Y-m-d h:i:s',###}}</td>
                                    <td>
                                        <div class="am-btn-toolbar">
                                            <div class="am-btn-group am-btn-group-xs">
                                                <a href="{{:U('AuthSet/edit_group',['id'=>$auth_group[id]])}}"
                                                   class="am-btn am-btn-default am-btn-xs am-text-secondary"><span
                                                        class="am-icon-pencil-square-o"></span> 编辑
                                                </a>

                                                <neq name="auth_group.id" value="1">
                                                    <a href="javascript:void (0);"
                                                       class="delete am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only">
                                                        <span class="am-icon-trash"></span> 删除
                                                    </a>
                                                </neq>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                            </volist>

                            </tbody>
                        </table>
                    </form>

                    <div class="am-cf">
                        共 {{$count}} 条记录
                        <div class="am-fr">
                            <ul class="am-pagination">

                                {{$pages}}

                            </ul>
                        </div>
                    </div>
                    <hr/>
                </div>

            </div>
        </div>

        <footer class="admin-content-footer">
            <hr>
            <p class="am-padding-left">© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
        </footer>

    </div>
</block>

<block name="js">
    <script>
        $(function () {
            $('.delete').click(function () {
                var id = $(this).parents('tr').data('id');
                _this = $(this);
                $.post("{{:U('delete_group')}}",{id:id},function () {
                    _this.parents('tr').fadeOut(400);
                });
                return false;
            });
        });
    </script>
</block>